package com.xxxx.spring.day09;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class D09 {

    public static void main(String[] param){
        Foo proxy = new $Proxy0(new InvocationHandler() {
            @Override
            public Object invoke(Object proxy,Method method, Object[] args) throws InvocationTargetException, IllegalAccessException {
                // 1.功能增强
                System.out.println("before...");
                // 2.调用目标
                // new Target().foo();
                return method.invoke(new Target(),args);
            }
        });
        proxy.foo();
        proxy.bar();
    }
}
